<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://displaytag.sf.net/el" prefix="display" %>

<html>

  <head>
    <title><s:text name="purchasersaction.title"/></title>
  </head>

  <body>

    <%-- pasek tytulowy --%>
    <p class="wwPageTitle">
      <img src="<s:url value='/images/purchaser.gif'/>"/>
      <s:text name="purchasersaction.list"/>
    </p>

    <%-- kryteria wyszukiwania --%>

    <s:actionerror />
    <s:actionmessage/>
    <s:fielderror />

    <s:form action="purchasers/list"
            method="POST"
            validate="true"
            cssClass="wwFilterTable">

      <tr>
        <th colspan="2">
          <s:text name="common.kryteriaWyszukiwania"/>
        </th>
      </tr>

      <s:textfield key="purchasersaction.id"
                   name="filter.id"
                   size="20" />
      
      <s:textfield key="purchasersaction.name"
                   name="filter.name"
                   size="75"/>

      <s:textfield key="purchasersaction.nip"
                   name="filter.nip"
                   size="20"/>

      <tr>
        <td colspan="2" class="wwFilterTableButtonBar">
          <s:submit key="button.show" cssClass="inputButton" theme="simple"/>
        </td>
      </tr>
      
    </s:form>

    <br/>

    <%-- dane --%>
    <div class="wwPageMenu">
      <s:url id="url" action="purchasers/create" />
      <a href="<s:property value="#url"/>" class="wwDataTable">
        <img src="<s:url value='/images/add.gif'/>"/>
        <s:text name="purchasersaction.add"/>
      </a>
    </div>

    <s:text id="col1Title" name="purchasersaction.id"/>
    <s:text id="col2Title" name="purchasersaction.name"/>
    <s:text id="col3Title" name="purchasersaction.address"/>
    <s:text id="col4Title" name="purchasersaction.nip"/>

    <display:table
        class="wwDataTable"
        id="rs"
        defaultsort="1"
        name="list"
        pagesize="10"
        partialList="true"
        size="filter.totalRecords"
        requestURI="list"
        excludedParams="button.show"
        sort="external">

      <display:column property="id"
                      title="${col1Title}"
                      class="nowrap percent1 integer"/>
                      
      <display:column title="${col2Title}">
        <s:property value="#attr.rs.nameHTML" escape="false"/>
      </display:column>

      <display:column property="nip"
                      title="${col4Title}"/>
      
      <display:column class="nowrap percent1" title="&nbsp;">
        <s:url action="purchasers/edit" id="url" includeParams="none">
          <s:param name="id" value="#attr.rs.id"/>
        </s:url>
        <s:a href="%{url}"><s:text name="button.edit"/></s:a>
        |
        <s:url action="purchasers/show" id="url" includeParams="none">
          <s:param name="id" value="#attr.rs.id"/>
        </s:url>
        <s:a href="%{url}"><s:text name="button.details"/></s:a>
        |
        <s:url action="purchasers/delete" id="url" includeParams="none">
          <s:param name="id" value="#attr.rs.id"/>
        </s:url>
        <s:text id="question4Remove" name="common.question4Remove"/>
        <s:a href="%{url}" onclick="return confirm('%{question4Remove}');">
            <s:text name="button.delete"/>
        </s:a>
      </display:column>
    </display:table>

  </body>

</html>
